cmake_minimum_required(VERSION 3.19)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_BUILD_TYPE Debug)
project(OpenFDB)
add_definitions(-D__TBB_CPP20_COMPARISONS_PRESENT=0)  
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake)

file(GLOB OPENFDB_SOURCE *.cpp *.h)

#add_library(OpenFDB SHARED ${OPENFDB_SOURCE})
add_executable(OpenFDB ${OPENFDB_SOURCE})
target_include_directories(OpenFDB PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}")
target_compile_options(OpenFDB PRIVATE $<$<COMPILE_LANGUAGE:CXX>: -Wno-ignored-attributes>)

if (WIN32)
    target_compile_options(OpenFDB PRIVATE "/arch:AVX")
else()
    target_compile_options(OpenFDB PRIVATE "-march=native")
endif()

target_compile_definitions(OpenFDB PRIVATE FMT_HEADER_ONLY)
find_package(OpenMP)
if (TARGET OpenMP::OpenMP_CXX)
    set_target_properties(OpenMP::OpenMP_CXX PROPERTIES IMPORTED_GLOBAL TRUE)
    target_link_libraries(OpenFDB PRIVATE OpenMP::OpenMP_CXX)
endif()

find_package(TBB CONFIG REQUIRED COMPONENTS tbb tbbmalloc)
target_link_libraries(OpenFDB PRIVATE TBB::tbb TBB::tbbmalloc pthread)
#target_link_libraries(OpenFDB PRIVATE zen)
